package ecommerce.model;

import java.util.List;

public class Photo {
	private String photoFarm;
	private String photoServer;
	private String photoId;
	private String photoOwner;
	private String photoSecret;
	private String photoUrlT;
	private String photoUrlO;
	private List<String> photoTags;
	private String photoTitle;
	
	public Photo() {}
	
	public Photo(String photoFarm, String photoServer, String photoId, String photoOwner, String photoSecret) {
		this.photoFarm = photoFarm;
		this.photoServer = photoServer;
		this.photoId = photoId;
		this.photoOwner = photoOwner;
		this.photoSecret = photoSecret;
		setPhotoUrlT();
		setPhotoUrlO();
		this.photoUrlT = getPhotoUrlT();
		this.photoUrlO = getPhotoUrlO();
	}	
	
	public void setPhotoFarm(String photoFarm){
		this.photoFarm = photoFarm;
	}
	
	public String getPhotoFarm(){
		return photoFarm;
	}
	
	public void setPhotoServer(String photoServer){
		this.photoServer = photoServer;
	}
	
	public String getPhotoServer(){
		return photoServer;
	}
	
	public void setPhotoId(String photoId){
		this.photoId = photoId;
	}
	
	public String getPhotoId(){
		return photoId;
	}
	
	public void setPhotoOwner(String photoOwner){
		this.photoOwner = photoOwner;
	}
	
	public String getPhotoOwner(){
		return photoOwner;
	}
	
	public void setPhotoSecret(String photoSecret){
		this.photoSecret = photoSecret;
	}
	
	public String getPhotoSecret(){
		return photoSecret;
	}
	
	public void setPhotoUrlT(){
		String photoLink = "http://farm<farm_id>.static.flickr.com/<server_id>/<photo_id>_<secret><size>.jpg";
	    photoLink = photoLink.replace("<farm_id>", photoFarm);
	    photoLink = photoLink.replace("<server_id>", photoServer);
	    photoLink = photoLink.replace("<photo_id>", photoId);
	    photoLink = photoLink.replace("<secret>", photoSecret);
	    photoLink = photoLink.replace("<size>", "_t");
		this.photoUrlT = photoLink;
	}
	
	public String getPhotoUrlT(){
		return photoUrlT;
	}
	
	public void setPhotoUrlO(){
		String photoLink = "http://farm<farm_id>.static.flickr.com/<server_id>/<photo_id>_<secret><size>.jpg";
	    photoLink = photoLink.replace("<farm_id>", photoFarm);
	    photoLink = photoLink.replace("<server_id>", photoServer);
	    photoLink = photoLink.replace("<photo_id>", photoId);
	    photoLink = photoLink.replace("<secret>", photoSecret);
	    photoLink = photoLink.replace("<size>", "");
		this.photoUrlO = photoLink;
	}
	
	public String getPhotoUrlO(){
		return photoUrlO;
	}
	
	public void setPhotoTags(List<String> photoTags){
		this.photoTags = photoTags;
	}
	
	public List<String> getPhotoTags(){
		return photoTags;
	}
	
	public void setPhotoTitle(String photoTitle){
		this.photoTitle = photoTitle;
	}
	
	public String getPhotoTitle(){
		return photoTitle;
	}
}
